#ifndef LEAVEAPPLICATIONVIEW_H
#define LEAVEAPPLICATIONVIEW_H

#include <QWidget>
#include <QComboBox>
#include <QDateEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QTableWidget>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "employeemanager.h"

class LeaveApplicationView : public QWidget
{
    Q_OBJECT
public:
    explicit LeaveApplicationView(EmployeeManager *employeeManager, const QString &empId, QWidget *parent = nullptr);
    void initUI();
    void loadLeaveRequests();
    void setEmployeeId(const QString &empId);

signals:
    void requestSubmitted(bool success);

private slots:
    void onSubmitRequest();
    void onCancelRequest();
    void onRequestTableItemClicked(int row, int column);

private:
    EmployeeManager *m_employeeManager;
    QString m_empId;
    QComboBox *m_leaveTypeComboBox;
    QDateEdit *m_startDateEdit;
    QDateEdit *m_endDateEdit;
    QTextEdit *m_reasonTextEdit;
    QPushButton *m_submitButton;
    QPushButton *m_cancelButton;
    QTableWidget *m_requestTableWidget;
    QLabel *m_statusLabel;
    int m_selectedRequestId;
};

#endif // LEAVEAPPLICATIONVIEW_H
